import argparse

def create_environment(env_name):
    print(f"Creating environment: {env_name}")
    # 这里可以添加实际的环境创建逻辑

def activate_environment(env_name):
    print(f"Activating environment: {env_name}")
    # 这里可以添加实际的环境激活逻辑

def install_package(env_name, package_name):
    print(f"Installing package {package_name} in environment {env_name}")
    # 这里可以添加实际的包安装逻辑

def main():
    parser = argparse.ArgumentParser(description="My Program CLI")

    subparsers = parser.add_subparsers(dest="command")

    # 创建环境子命令
    create_parser = subparsers.add_parser("create", help="Create a new environment")
    create_parser.add_argument("env_name", type=str, help="Name of the environment")

    # 激活环境子命令
    activate_parser = subparsers.add_parser("activate", help="Activate an environment")
    activate_parser.add_argument("env_name", type=str, help="Name of the environment")

    # 安装包子命令
    install_parser = subparsers.add_parser("install", help="Install a package in an environment")
    install_parser.add_argument("env_name", type=str, help="Name of the environment")
    install_parser.add_argument("package_name", type=str, help="Name of the package")

    args = parser.parse_args()

    if args.command == "create":
        create_environment(args.env_name)
    elif args.command == "activate":
        activate_environment(args.env_name)
    elif args.command == "install":
        install_package(args.env_name, args.package_name)
    else:
        parser.print_help()

if __name__ == "__main__":
    main()